package com.lee.spring.service.impl;

import com.lee.mybatis.entity.Role;
import com.lee.mybatis.entity.User;
import com.lee.mybatis.mapper.UserMapper;
import com.lee.spring.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Slf4j
@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper userMapper;

    @Override
    public User login(String userName, String password) {
            log.info("正在登录...");
        return userMapper.login(userName,password);
    }

    @Override
    public void insert(User user) {
        log.info("正在插入...");
        userMapper.insert(user);
    }

    @Override
    public void updateById(User user) {
        log.info("正在修改...");
        userMapper.updateById(user);
    }

    @Override
    public void deleteById(Integer id) {
        log.info("正在删除...");
        userMapper.deleteById(id);
    }

    @Override
    public List<User> selectWithUserNo() {
        log.info("正在查询...");
       return userMapper.selectWithUserNo();
    }

    @Override
    public List<Role> selectByUserId(Integer id) {
        return userMapper.selectByUserId(id);
    }


}
